package com.hyt.it.ogt.controller.ykcj.grade;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;
import com.hyt.it.ogt.controller.base.BaseController;
import com.hyt.it.ogt.ykcj.common.core.domain.AjaxResult;
import com.hyt.it.ogt.ykcj.common.core.page.TableDataInfo;
import com.hyt.it.ogt.ykcj.domain.vo.ExamReviewInfoVo;
import com.hyt.it.ogt.ykcj.domain.vo.QueryEnterpriseExamineeGradeVo;
import com.hyt.it.ogt.ykcj.service.grade.IEnterpriseExamineeInfoService;
import com.hyt.it.ogt.ykcj.service.grade.IEnterpriseExamineeReviewInfoService;

import groovy.util.logging.Slf4j;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiSort;

/**
 * 企业招聘考生复核成绩信息Controller
 *
 * @author liying
 * @date 2021-11-19
 */
@Api(tags = "grade.10.企业招聘考生复核成绩信息")
@ApiSort(value = 210)
@RestController
@RequestMapping("/enterprise/review/info")
@Slf4j
public class EnterpriseExamineeReviewInfoController extends BaseController {

    @Autowired
    private IEnterpriseExamineeInfoService enterpriseExamineeInfoService;

    @Autowired
    private IEnterpriseExamineeReviewInfoService enterpriseExamineeReviewInfoService;


    /**
     * 查询企业招聘考生复核信息列表
     */
    @ApiOperation(value = "查询企业招聘考生复核信息列表", response = ExamReviewInfoVo.class)
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody QueryEnterpriseExamineeGradeVo queryExamineeGradeVo) {
        PageInfo<List<ExamReviewInfoVo>> pageInfo = enterpriseExamineeInfoService.selectReviewEnterpriseExamineeGradePage(queryExamineeGradeVo);
        return getDataTable(pageInfo);
    }


    /**
     * 查询企业招聘考生复核信息
     */
    @ApiOperation(value = "查询企业招聘考生复核信息", response = ExamReviewInfoVo.class)
    @PostMapping("/detail/{id}")
    public AjaxResult list(@PathVariable("id") String id) {
        ExamReviewInfoVo examReviewInfoVo = enterpriseExamineeReviewInfoService.selectExamineeReviewInfoById(id);
        return AjaxResult.success(examReviewInfoVo);
    }

    /**
     * 保存复核申请
     * @param examReviewInfoVo
     * @return
     */
    @ApiOperation(value = "保存考生复核信息")
    @PostMapping("/saveExamReviewInfo")
    public AjaxResult saveExamReviewInfo(@RequestBody ExamReviewInfoVo examReviewInfoVo) throws Exception{
        return AjaxResult.success(enterpriseExamineeReviewInfoService.saveExamReviewInfoVo(examReviewInfoVo));
    }

}
